#include "enrollwindow.h"
#include "ui_enrollwindow.h"
#include <QMessageBox>
QString verifynum;
enrollwindow::enrollwindow(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::enrollwindow)
{
    ui->setupUi(this);
}

enrollwindow::~enrollwindow()
{
    delete ui;
}


void enrollwindow::on_enroll_clicked()
{
    if(ui->password->text()!=ui->passwordconfirm->text()){
        QMessageBox::warning(this, tr("Waring"),
                                      tr("两次密码输入不同！"),
                                      QMessageBox::Yes);
        ui->password->clear();
        ui->passwordconfirm->clear();}
    else if(ui->confirmnum->text()!=verifynum){


        QMessageBox::warning(this, tr("Waring"),
                                      tr("验证码错误！"),
                                      QMessageBox::Yes);
        ui->confirmnum->clear();

    }
    else{

   QString id=mysocket->AddUser(ui->phone->text(),ui->name->text(),ui->password->text());


    }

}
void enrollwindow::GetTCPsocket(TCPSocket *socket){
mysocket=socket;
}

void enrollwindow::on_send_clicked()
{
   verifynum=mysocket->verifynum(ui->phone->text());
}
